<template>

   <editor api-key="0tc5chc0hx9tldfsj4ge70mu2jf6mndgkl10qscy4mbln6rp" :init="init" />

</template>

<script>
import editor from '@tinymce/tinymce-vue';
let tinymce;
	// 在客户端环境下引入
    if (process.client) {
        tinymce = require('tinymce/tinymce');
        require('tinymce/themes/silver');
        require('tinymce/icons/default');
        // require('tinymce/plugins/image');// 插入上传图片插件
        // require('tinymce/plugins/media');// 插入视频插件
        // require('tinymce/plugins/table');// 插入表格插件
        // require('tinymce/plugins/lists');// 列表插件
        // require('tinymce/plugins/link');//超链接插件
        // require('tinymce/plugins/wordcount');// 字数统计插件
        // require('tinymce/plugins/emoticons');// 插入表情插件
        // require('tinymce/plugins/fullscreen');
        // require('tinymce/plugins/code');
        // require('tinymce/plugins/paste');
        // require('tinymce/plugins/advlist');
        // require('tinymce/plugins/autolink');
        // require('tinymce/plugins/autosave');
        // require('tinymce/plugins/codesample');
        // require('tinymce/plugins/colorpicker');
        // require('tinymce/plugins/contextmenu');
        // require('tinymce/plugins/directionality');
        // require('tinymce/plugins/nonbreaking');
        // require('tinymce/plugins/insertdatetime');
        // require('tinymce/plugins/preview');
        // require('tinymce/plugins/print');
        // require('tinymce/plugins/save');
        // require('tinymce/plugins/searchreplace');
        // require('tinymce/plugins/spellchecker');
        // require('tinymce/plugins/tabfocus');
        // require('tinymce/plugins/table');
        // require('tinymce/plugins/template');
        // require('tinymce/plugins/textcolor');
        // require('tinymce/plugins/visualblocks');
        // require('tinymce/plugins/textpattern');
        // require('tinymce/plugins/visualchars');
        // require('tinymce/plugins/wordcount');
        // require('tinymce/plugins/anchor');
        // require('tinymce/plugins/hr');
        // require('tinymce/plugins/link');
        // require('tinymce/plugins/noneditable');
        // require('tinymce/plugins/pagebreak');
        require('tinymce/plugins/autoresize');
      }

export default {
  name: 'TinyMCE',
  components: {
    editor
    // Editor
  },
  props: {},
  head() {
    return {
      script: [{
        src: "/tinymce/tinymce.min.js"
      }]
    }
  },
  mounted() {


  },
  data() {
    return {

      init: {
        selector:'textarea',
        menubar: false,
        language_url: '/tinymce/zh_CN.js',
        language: 'zh_CN',
        skin_url: '/tinymce/skins/ui/oxide',// skin路径
        block_formats: 'Paragraph=p;Header 3=h3;Header 4=h4;',
        placeholder: '说点什么吧...',
        plugins: [
          'autoresize',
        ],
        toolbar: false,
        // toolbar: 'formatselect | bold | \
        //   alignleft aligncenter | \
        //   '
      }
    }
  },
  created() {
    window.tinymce.init(this.init)
  },
  methods: {
    getContent(){
       return tinymce.activeEditor.getContent()
    }
  },
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>


</style>
